package com.xuexuehai.bkm.core.common.dto;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.time.LocalDateTime;

/**
 * @author xuexuehai
 * @mailBox xuehai.xue@QQ.com
 * @date 2021/9/11 11:27 上午
 */
@Data
@NoArgsConstructor
@ToString
public class HttpResp {
    private int code;
    private String msg;
    private Object results;
    private LocalDateTime times;
    private String token;

    public HttpResp(Builder builder){
        this.code = builder.code;
        this.msg = builder.msg;
        this.results = builder.results;
        this.times = builder.times;
        this.token = builder.token;
    }

    public static class Builder{
        private int code;
        private String msg;
        private Object results;
        private LocalDateTime times;
        private String token;

        public Builder code(int code){
            this.code = code;
            return this;
        }

        public Builder msg(String msg){
            this.msg = msg;
            return this;
        }

        public Builder results(Object results){
            this.results = results;
            return this;
        }

        public Builder times(LocalDateTime times){
            this.times = times;
            return this;
        }

        public Builder token(String token){
            this.token = token;
            return this;
        }

        public HttpResp builder(){
            return new HttpResp(this);
        }
    }
}
